﻿<%@ Page Title="Diskusní fóra" Language="C#" MasterPageFile="~/Pages/Site.Master" AutoEventWireup="true" CodeBehind="HomePage.aspx.cs" Inherits="Altairis.FluffyCloud.WebCore.Pages.Forum.HomePage" %>
<asp:Content ContentPlaceHolderID="Main" runat="server">
    <h1>Diskusní fóra</h1>
    <asp:ListView ID="CategoryList" runat="server" ItemType="Altairis.FluffyCloud.Data.Views.TopicCategoryInfo" SelectMethod="CategoryList_GetData">
        <ItemTemplate>
            <section class="topics">
                <header>
                    <h2><%# Item.Name %></h2>
                </header>
                <asp:ListView ID="ForumList" runat="server" ItemType="Altairis.FluffyCloud.Data.Views.TopicInfo" DataSource="<%# Item.Topics.OrderByDescending(x => x.LastPostDate) %>">
                    <EmptyDataTemplate>
                        <p>Tato kategorie je prázdná.</p>
                    </EmptyDataTemplate>
                    <ItemTemplate>
                        <article>
                            <header>
                                <asp:HyperLink Text="<%#: Item.Name %>" NavigateUrl='<%# this.GetRouteUrl("ForumDetail", new { id = Item.TopicId }) %>' runat="server" />
                            </header>
                            <aside>
                                <asp:Label Text="aktualizováno" runat="server" CssClass="new" Visible="<%# Item.LastPostDate> Item.LastVisitDate %>" />
                                <span class="owner">
                                    <asp:HyperLink NavigateUrl='<%# this.GetRouteUrl("UserProfile", new { username= Item.UserName }) %>' Text="<%#: Item.UserName %>" runat="server" />
                                </span>
                                <span class="postcount"><%# Item.PostCount %></span>
                                <span class="lastpost"><%#: Item.LastPostDate.ToLocalDisplayFormat() %></span>
                                <span class="lastpostby">
                                    <asp:HyperLink NavigateUrl='<%# this.GetRouteUrl("UserProfile", new { username= Item.LastPostUserName }) %>' Text="<%#: Item.LastPostUserName %>" runat="server" />
                                </span>
                            </aside>
                            <%#: Item.Description %>
                        </article>
                    </ItemTemplate>
                </asp:ListView>
            </section>
        </ItemTemplate>
    </asp:ListView>
    <asp:Button Text="Založit nové" runat="server" ID="ButtonNewTopic" OnClick="ButtonNewTopic_Click" />
</asp:Content>